/**
 * CarbonMetalPanel is a simple Canvas, rather than a complex container derived from CarbonPanel.
 * Therefore, CarbonMetalPanel is NOT resizable, do no possess a CarbonBorder, but it does has some goodies such as built-in shadow filter.
 * 
 * The way to pipe properties to a graphical skin, like CarbonMetalPanelSkin, is to bind them to a style. This is not actually
 * graceful, but it certainly does the trick.
 */
package org.delphy.indy2.containers
{
	import mx.containers.Canvas;
	
	import org.delphy.indy2.containers.carbonPanelClasses.CarbonMetalPanelSkin;
	import org.delphy.indy2.core.ICarbonComponent;
	
	//--------------------------------------
	//  Styles
	//--------------------------------------
	
	/**
	*	Top-left corner radius
	*	
	*	@default 0
	*/
	[Style(name="topLeftRadius", type="Number", format="Length", inherit="no")]
	
	/**
	*	Top-right corner radius
	*	
	*	@default 0
	*/
	[Style(name="topRightRadius", type="Number", format="Length", inherit="no")]
	
	/**
	*	Bottom-left corner radius
	*	
	*	@default 0
	*/
	[Style(name="bottomLeftRadius", type="Number", format="Length", inherit="no")]

	/**
	*	Bottom-right corner radius
	*	
	*	@default 0
	*/
	[Style(name="bottomRightRadius", type="Number", format="Length", inherit="no")]
	
	/**
	 * Texture of background
	 * 
	 * @default Embed(source="org/delphy/indy2/assets/images/metalTexture.png")
	 **/
	[Style(name="texture", type="Class", inherit="no")]
	
	/**
	 * Weight of metallic splitter
	 * 
	 * @default 2
	 */
	[Style(name="splitterWeight", type="Number", format="Length", inherit="no")]
	
	/**
	 * Whether to draw the splitter
	 * 
	 * @default true
	 */
	[Style(name="useSplitter", type="Boolean", inherit="no")]
	
	/**
	 * Splitter fill colors
	 * 
	 * @default #000000, #FFFFFF, #000000
	 */
	[Style(name="splitterColors", type="Array", arrayType="Number", inherit="no")]

	/**
	 * Splitter fill alphas
	 * 
	 * @default 1
	 */
	[Style(name="splitterAlphas", type="Array", arrayType="Number", inherit="no")]

	/**
	 * Splitter fill ratios
	 * 
	 * @default 0, 0.5, 1
	 */
	[Style(name="splitterRatios", type="Array", arrayType="Number", inherit="no")]

	/**
	 * Splitter fill ratio units
	 * 
	 * @default ratio
	 */
	[Style(name="splitterRatioUnits", type="Array", arrayType="Number", inherit="no")]
	
	/**
	 * highlight fill colors
	 * 
	 * @default #000000, #FFFFFF, #000000
	 */
	[Style(name="highlightColors", type="Array", arrayType="Number", inherit="no")]
	
	/**
	 * highlight fill alphas
	 * 
	 * @default 1
	 */
	[Style(name="highlightAlphas", type="Array", arrayType="Number", inherit="no")]
	
	/**
	 * highlight fill ratios
	 * 
	 * @default 0, 0.5, 1
	 */
	[Style(name="highlightRatios", type="Array", arrayType="Number", inherit="no")]
	
	/**
	 * highlight fill ratio units
	 * 
	 * @default ratio
	 */
	[Style(name="highlightRatioUnits", type="Array", arrayType="Number", inherit="no")]	
	
	/**
	 * Splitter filters
	 * The filter properties are arrays of style strings.
	 * 
	 * @default "carbonMetalPanelSplitterBevelFilter", "carbonMetalPanelSplitterShadowFilter"
	 */	
	[Style(name="splitterFilter", type="String", inherit="no")]

	/**
	 * Highlight filters
	 * The filter properties are arrays of style strings.
	 * 
	 * @default "carbonMetalPanelHighlightBlurFilter"
	 */	
	[Style(name="highlightFilter", type="String", inherit="no")]

	
	public class CarbonMetalPanel extends Canvas implements ICarbonComponent
	{	
		/** Default Skin
		 * @default org.delphy.indy2.containers.carbonPanelClasses.CarbonMetalPanelSkin
		 */
		protected var defaultSkin:Class = CarbonMetalPanelSkin;
		
		/**
		 *	Constructor
		 */		
		public function CarbonMetalPanel()
		{
			super();
		}		
		
		override protected function commitProperties() : void{
			super.commitProperties();

			// Fallback to default skin
			if(!styleName)
				styleName="carbonMetalPanel";

			if(!getStyle("borderSkin"))
				setStyle("borderSkin", defaultSkin);				
		}
		
		/**
		 * @public
		 */
		public function get defaultStyleName():String{
			return "carbonMetalPanel";
		}
	}
}